package casa.depesos.app.com.http.req;


import casa.depesos.app.com.http.HttpReq;
import casa.depesos.app.com.http.Req;
import casa.depesos.app.com.http.ReqCallback;
import casa.depesos.app.com.http.bean.GetCodeBean;
import casa.depesos.app.com.http.data.CodeType;
import casa.depesos.app.com.http.parser.GetCodeParser;
import okhttp3.FormBody;

public class CheckCodeReq implements HttpReq<GetCodeBean> {

    private String phone, code;
    private CodeType type;

    public CheckCodeReq(String phone, String code, CodeType type) {
        this.phone = phone;
        this.code = code;
        this.type = type;
    }

    @Override
    public void req(ReqCallback<GetCodeBean> callback) {//  /app/user/verifyCode
        FormBody.Builder builder = new FormBody.Builder()
                .add("mobile", phone)
                .add("validatiCod", code)
                .add("useCase", type.str());
        Req.post("/app/consumer/validateSecurityPin", getParam(), getHeader(), builder.build(), new GetCodeParser(), callback, this);
    }
}
